import Row from "../../qbasics/basics/Row";
import  LexCore from "./LexCore"
import fs from 'fs';
const readline = require('readline')

const path = require('path');
let fsPath=path.join(__dirname ,"./测试.jsr" )
let lexCore=new LexCore();
lexCore.init();



function read() {
    let data=fs.readFileSync(fsPath);
    debugger
    lexCore.loadData(data)
}
function write() {
    debugger
    let data=fs.writeFileSync(fsPath,lexCore.outData());
}
read()
debugger
let str="把选中的字,移动到最后"
let ids= lexCore.run(str);
/*let ides=lexCore.lexRun(ids);
debugger
let yaccType=lexCore.yaccType(ides);*/
console.log(ids)
debugger
//添加词
lexCore.addIder("选中")
lexCore.addIder("移动")
lexCore.addIder("最后")
//添加是否可以独立存在
lexCore.iderAddSign("把",new Row(1,1))
lexCore.iderAddSign("到",new Row(1,1))
lexCore.iderAddSign("的",new Row(1,1))
lexCore.iderAddSign("字",new Row(1,1))
lexCore.iderAddSign(",",new Row(1,1))
//添加语法类型
lexCore.iderAddType("选中","名词")
lexCore.iderAddType("移动","动词")
lexCore.iderAddType("最后","名词")
lexCore.iderAddType("把","把")
lexCore.iderAddType("到","到")
lexCore.iderAddType("的","的")
lexCore.iderAddType("字","名词")
lexCore.iderAddType(",","逗号")
lexCore.outData()
debugger;
/*let ides=lexCore.lexRun(ids);


let yaccType=lexCore.yaccType(ides);*/
console.log(ides)
console.log(yaccType)
write()

debugger

let srt1=[{type:'把',        'data':'把'},
           {type:'名词',     'data':'选中'},
           {type:'的',       'data':'的'},
           {type:'名词',     'data':'字'},
           {type:'动词',     'data':'移动'},
           {type:'到',       'data':'到'},
           {type:'名词',     'data':'最后'}]

